package com.swf.seed.algorithms.util;

public class SortUtil {
	public static String i2s(int[] is){
		StringBuilder stringBuilder = new StringBuilder();
		for (int i=0;i<is.length;i++){
			stringBuilder.append(",").append(is[i]);
		}
		return "["+stringBuilder.substring(1)+"]";
	}
	
	public static void printMap(int[] queenList){
		System.out.print(' ');
		for (int i=0;i<queenList.length;i++){
			System.out.print(i);
		}
		System.out.println();
		for (int i=0;i<queenList.length;i++){
			System.out.print(i);
			for (int j=0;j<queenList.length;j++){
				System.out.printf("%c",queenList[i]==j?'q':'*');
			}
			System.out.println();
		}
	}
	
	public static String repeatStr(String str,int times){
		StringBuilder builder = new StringBuilder();
		for (int i=0;i<times;i++){
			builder.append(str);
		}
		return builder.toString();
	}
	public static void swap(int[] ori,int i,int j){
		int temp = ori[i];
		ori[i] = ori[j];
		ori[j] = temp;
	}
	public static  void swap(char[] ori,int i,int j){
		char temp = ori[i];
		ori[i] = ori[j];
		ori[j] = temp;
	}
}
